import time
from selenium.webdriver import Chrome
from selenium.webdriver.common.by import By

# driver = Chrome()
#
# driver.get("http://192.168.91.131:8080/ssmj858g/admin/dist/index.html#/")
#
# driver.maximize_window()
#
#
# driver.find_element(By.NAME, "username").send_keys("1")
# driver.find_element(By.NAME, "password").send_keys("1")
#
# title=driver.title
# if title=="后台管理系统":
#     print("登录成功")
# else:
#     print("登录失败")
#
# driver.find_element(By.CLASS_NAME,"el-radio__input")
# if len(driver.find_elements(By.CLASS_NAME,"el-radio__input"))>1:
#     driver.find_elements(By.CLASS_NAME,"el-radio__input")[2].click()
#
# driver.find_element(By.CLASS_NAME,"el-button.loginInBt.el-button--primary.el-button--medium").click()
#
# time.sleep(10)


a = Chrome()

a.get("http://192.168.91.131:8080/ssmj858g/admin/dist/index.html#/")
a.maximize_window()

a.find_element(By.NAME, "username").send_keys("abo")
a.find_element(By.NAME, "password").send_keys("abo")
a.find_element(By.CLASS_NAME,"el-radio__input")
if len(a.find_elements(By.CLASS_NAME,"el-radio__input"))>1:
    a.find_elements(By.CLASS_NAME,"el-radio__input")[0].click()
a.find_element(By.CLASS_NAME,"el-button.loginInBt.el-button--primary.el-button--medium").click()


time.sleep(3)

a.find_element(By.XPATH,'//*[@id="app"]/section/section/aside/div/div/ul/li[3]/div').click()
time.sleep(3)
a.find_element(By.XPATH,"/html/body/div/section/section/aside/div/div/ul/li[3]/ul/li").click()
time.sleep(3)
a.find_element(By.XPATH,"/html/body/div/section/section/main/div[2]/div/div/div[1]/div[3]/table/tbody/tr[2]/td[8]/div/button[3]").click()
time.sleep(3)
a.find_element(By.XPATH,"/html/body/div[2]/div/div[3]/button[2]").click()
time.sleep(3)

a.quit()




# b=Chrome()
#
# b.get("http://192.168.91.131:8080/ssmj858g/admin/dist/index.html#/")
#
# b.maximize_window()
#
# b.find_element(By.CLASS_NAME,"register").click()
# time.sleep(3)
#
# # 获取所有 input 元素
# inputs = b.find_elements(By.CSS_SELECTOR, "input")
#
# # 确保找到了足够多的 input 元素
# if len(inputs) >= 5:
#     inputs[0].send_keys("11")
#     inputs[1].send_keys("123456")
#     inputs[2].send_keys("朱启灵")
#     inputs[3].send_keys("130726200307654245")
#     inputs[4].send_keys("15084658520")
# else:
#     print(f"只找到了 {len(inputs)} 个 input 元素，需要至少 5 个")
#
#
# time.sleep(5)
#
# # 获取所有button元素并点击第一个
# buttons = b.find_elements(By.CSS_SELECTOR, "button")
# if buttons:  # 检查是否找到按钮
#     buttons[0].click()  # 点击第一个按钮
# else:
#     print("没有找到任何按钮元素")
#
# time.sleep(5)








